use crate::dto;
use serde::{Deserialize, Serialize};
use validator::Validate;
use wanmesh_common::validator::validate_string_is_not_empty;

pub type AddRequest = AddParams;

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct AddParams {
    #[serde(flatten)]
    pub inner: dto::core::segment_list::AddParams,
    pub endpoint_id_list: Vec<String>,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct UpdateRequest {
    #[validate(custom(function = "validate_string_is_not_empty"))]
    pub segment_list_id: String,
    pub params: dto::core::segment_list::UpdateParams,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct GetRequest {
    #[validate(custom(function = "validate_string_is_not_empty"))]
    pub segment_list_id: String,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct DeleteRequest {
    #[validate(custom(function = "validate_string_is_not_empty"))]
    pub segment_list_id: String,
}

pub type ListRequest = wanmesh_common::dto::ListRequest<dto::core::segment_list::Filter>;
pub type ListInfoResponseData =
    wanmesh_common::dto::ListResponseData<dto::segment_list::SegmentListInfo>;
